
package ar.republicagroup.gestion.view;

import ar.republicagroup.gestion.entities.Banco;
import ar.republicagroup.gestion.entities.BolsaCheque;
import ar.republicagroup.gestion.entities.Cheque;
import ar.republicagroup.gestion.entities.ChequeEstado;
import ar.republicagroup.gestion.entities.ChequeTipo;
import ar.republicagroup.gestion.entities.Cliente;
import ar.republicagroup.gestion.entities.CuentaBanco;
import ar.republicagroup.gestion.entities.Usuario;
import ar.republicagroup.gestion.services.BancoServices;
import ar.republicagroup.gestion.services.BolsaChequeServices;
import ar.republicagroup.gestion.services.ChequeServices;
import ar.republicagroup.gestion.services.ChequeTipoServices;
import ar.republicagroup.gestion.services.ClienteServices;
import ar.republicagroup.gestion.services.CodigoPostalServices;
import ar.republicagroup.gestion.services.CuentaBancoServices;
import ar.republicagroup.gestion.util.ClickAction;
import ar.republicagroup.gestion.util.JComboBoxModel;
import ar.republicagroup.gestion.util.SpringUtils;
import ar.republicagroup.gestion.util.UserSession;
import ar.republicagroup.gestion.util.Validar;
import ar.republicagroup.gestion.util.helpers.Formato;
import ar.republicagroup.gestion.util.messages.UIMessages;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.table.DefaultTableModel;
import org.apache.log4j.Logger;

public class modalPanelAddCheque extends javax.swing.JDialog {

    /* SERVICES */
    ChequeServices       chequeServices       = (ChequeServices)SpringUtils.getBean("chequeServices");
    ClienteServices      clienteServices      = (ClienteServices)SpringUtils.getBean("clienteServices");
    CuentaBancoServices  cuentaBancoServices  = (CuentaBancoServices)SpringUtils.getBean("cuentaBancoServices");
    ChequeTipoServices   chequeTipoServices   = (ChequeTipoServices)SpringUtils.getBean("chequeTipoServices");
    BolsaChequeServices  bolsaChequeServices  = (BolsaChequeServices)SpringUtils.getBean("bolsaChequeServices");
    BancoServices        bancoServices        = (BancoServices)SpringUtils.getBean("bancoServices");
    CodigoPostalServices codigoPostalServices = (CodigoPostalServices)SpringUtils.getBean("codigoPostalServices");
    
    /* BEANS */
    Banco           banco                   = new Banco();
    Cliente         cliente                 = new Cliente();
    private static  Cheque  chequeEditado   = new Cheque();
    
    /* LIST*/
    private static List<Cheque>    chequeList  = new ArrayList<Cheque>();
    boolean cheque_valido       = false;
    Logger log                  = Logger.getLogger(modalPanelAddCheque.class);
    /* INTERNO */
    private static double montoTotalBolsa      = 0;
    boolean canceloAlta         = false;
    boolean noRefrescarTabla    = false;
    
    /*CONSTANTES*/
    private static final int SUMAR = 0;
    private static final int RESTAR = 1;
    private static final boolean CHEQUE_INVALIDO = false;
    private static final boolean CHEQUE_VALIDO   = true;
    
    DecimalFormat formatoDecimal = new DecimalFormat("#####.##");
    
    
    
    public modalPanelAddCheque(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        valoresPorDefecto();
        cargarCombos();     
    }

    public static Cheque getChequeEditado() {
        return chequeEditado;
    }

    public static void setChequeEditado(Cheque chequeEditado) {
        modalPanelAddCheque.chequeEditado = chequeEditado;
    }

    
    public static void actualizarListadoConChequeEditado(){
        int indice = 0;
        montoTotalBolsa = 0;
        
        if(chequeList.contains(chequeEditado)){
            for(Cheque cheque : chequeList){
                if(cheque.getCodigoString().equals(chequeEditado.getCodigoString())){
                    chequeList.set(indice, chequeEditado);
                    montoTotalBolsa += chequeEditado.getImporte().doubleValue();
                }else{
                    montoTotalBolsa += cheque.getImporte().doubleValue();
                } 
                indice++;
            }
        }
                
            System.out.println("montoTotalBolsa : "+montoTotalBolsa);
            cargarTablaBolsaDeCheques(chequeList);
            lblMonto.setText(Formato.decimalComaMilesConSigno(montoTotalBolsa));
        }
 
    
    private void cargarCombos(){
        comboCliente.setModel(clienteServices.combo());
        comboChequeTipo.setModel(chequeTipoServices.combo());
        comboCuentaBanco.setModel(cuentaBancoServices.combo());
    }
    
    private void valoresPorDefecto(){
        lblErrorImporte.setVisible(false);
        lblTotalBolsa.setText("Total bolsa: ");
        lblMonto.setText(""+Formato.decimalComaMilesConSigno(montoTotalBolsa));
        lblChequeCorrecto.setVisible(false);
        txtCodigoString.setFocusTraversalKeysEnabled(false);
    }
    
    private static void cargarTablaBolsaDeCheques(List<Cheque> listado){
        DefaultTableModel model = (DefaultTableModel) tblBolsaCheques.getModel();
        model.getDataVector().clear();
        
        for(Cheque cheque : listado){
            model.addRow(new Object[]{cheque,Formato.decimalComaMilesConSigno(cheque.getImporte().doubleValue()) });
        }
        tblBolsaCheques.setModel(model);
        tblBolsaCheques.repaint();
    }
    
   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelContenedor = new javax.swing.JPanel();
        comboCliente = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtCodigoString = new javax.swing.JTextField();
        comboChequeTipo = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        txtBanco = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtNroCheque = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtNroCuenta = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtOrigen = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        txtComision = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtImporte = new javax.swing.JTextField();
        btnRegistrar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        lblErrorImporte = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblBolsaCheques = new javax.swing.JTable();
        btnEliminar = new javax.swing.JButton();
        btnInspeccionarCheque = new javax.swing.JButton();
        lblChequeCorrecto = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        lblMonto = new javax.swing.JLabel();
        lblTotalBolsa = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        lblTotalCheques = new javax.swing.JLabel();
        comboCuentaBanco = new javax.swing.JComboBox();
        chkAsignarACuenta = new javax.swing.JCheckBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("...: Alta de cheque :...");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        panelContenedor.setBorder(javax.swing.BorderFactory.createTitledBorder("Nuevo cheque"));

        comboCliente.setBackground(new java.awt.Color(204, 204, 255));
        comboCliente.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                comboClienteItemStateChanged(evt);
            }
        });

        jLabel1.setText("Cliente");

        jLabel2.setText("Ingrese código");

        txtCodigoString.setEditable(false);
        txtCodigoString.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtCodigoStringKeyPressed(evt);
            }
        });

        comboChequeTipo.setEnabled(false);
        comboChequeTipo.setNextFocusableComponent(txtImporte);
        comboChequeTipo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                comboChequeTipoKeyPressed(evt);
            }
        });

        jLabel3.setText("Tipo cheque");

        txtBanco.setEditable(false);
        txtBanco.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        jLabel5.setText("Banco");

        txtNroCheque.setEditable(false);

        jLabel6.setText("Nro.Cheque");

        txtNroCuenta.setEditable(false);

        jLabel7.setText("Nro.Cuenta");

        jLabel8.setText("Origen");

        txtOrigen.setEditable(false);

        jLabel9.setText("Comisión");

        txtComision.setEditable(false);

        jLabel10.setText("Importe");

        txtImporte.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtImporteFocusLost(evt);
            }
        });
        txtImporte.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtImporteKeyPressed(evt);
            }
        });

        InputMap inputMap = btnRegistrar.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW);
        KeyStroke ctrl_r = KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK);
        inputMap.put(ctrl_r, "CTRL_R");
        btnRegistrar.getActionMap().put("CTRL_R", new ClickAction(btnRegistrar));
        btnRegistrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/add.png"))); // NOI18N
        btnRegistrar.setText("Registrar");
        btnRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegistrarActionPerformed(evt);
            }
        });

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/cancel.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        lblErrorImporte.setForeground(new java.awt.Color(255, 0, 0));
        lblErrorImporte.setText("Mensaje de error");

        tblBolsaCheques.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Nro.Cheque", "Monto"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblBolsaCheques.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(tblBolsaCheques);

        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/minus.png"))); // NOI18N
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });

        btnInspeccionarCheque.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/search.png"))); // NOI18N
        btnInspeccionarCheque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInspeccionarChequeActionPerformed(evt);
            }
        });

        lblChequeCorrecto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/check.png"))); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Bolsa actual"));

        lblMonto.setText("lblMonto");

        lblTotalBolsa.setText("lblTotalBolsa");

        jLabel4.setText("Cheques");

        lblTotalCheques.setText("0");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(23, 23, 23)
                        .addComponent(lblTotalCheques))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblTotalBolsa)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblMonto)))
                .addContainerGap(115, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblTotalCheques, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMonto)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(lblTotalBolsa)
                        .addContainerGap())))
        );

        comboCuentaBanco.setEnabled(false);

        chkAsignarACuenta.setText("Asignar bolsa a esta cuenta");
        chkAsignarACuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkAsignarACuentaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelContenedorLayout = new javax.swing.GroupLayout(panelContenedor);
        panelContenedor.setLayout(panelContenedorLayout);
        panelContenedorLayout.setHorizontalGroup(
            panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelContenedorLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9)
                    .addComponent(jLabel8)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(comboCliente, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(comboChequeTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNroCuenta)
                    .addComponent(txtNroCheque)
                    .addComponent(txtOrigen)
                    .addComponent(txtCodigoString)
                    .addComponent(txtComision, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtBanco, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                    .addGroup(panelContenedorLayout.createSequentialGroup()
                        .addComponent(txtImporte, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblErrorImporte))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panelContenedorLayout.createSequentialGroup()
                            .addGap(25, 25, 25)
                            .addComponent(btnRegistrar)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(btnCancelar))
                        .addGroup(panelContenedorLayout.createSequentialGroup()
                            .addComponent(lblChequeCorrecto)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(chkAsignarACuenta)
                        .addComponent(comboCuentaBanco, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnInspeccionarCheque))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelContenedorLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnEliminar, btnInspeccionarCheque});

        panelContenedorLayout.setVerticalGroup(
            panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelContenedorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chkAsignarACuenta)
                    .addComponent(comboCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboCuentaBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtCodigoString, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelContenedorLayout.createSequentialGroup()
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(lblChequeCorrecto)
                                .addComponent(jLabel3))
                            .addGroup(panelContenedorLayout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(comboChequeTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtNroCheque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtNroCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtComision, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(txtImporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblErrorImporte))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelContenedorLayout.createSequentialGroup()
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelContenedorLayout.createSequentialGroup()
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContenedorLayout.createSequentialGroup()
                                .addComponent(btnInspeccionarCheque)
                                .addGap(18, 18, 18)
                                .addComponent(btnEliminar)
                                .addGap(163, 163, 163)))
                        .addGroup(panelContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRegistrar)
                            .addComponent(btnCancelar))))
                .addContainerGap(39, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void comboClienteItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_comboClienteItemStateChanged
         JComboBoxModel model     = (JComboBoxModel) comboCliente.getSelectedItem();
         int id_cliente           = Integer.valueOf(model.getValue());
         montoTotalBolsa          = 0;
         
           if (id_cliente !=0){
                cliente = clienteServices.get(id_cliente);
                txtCodigoString.setText("");
                txtCodigoString.setEditable(true);
                txtCodigoString.requestFocus(); 
                lblMonto.setText("0");
                lblTotalCheques.setText("0");
                limpiarFormulario();
                chequeList.removeAll(chequeList);
                cargarTablaBolsaDeCheques(chequeList);
               
            } else {
                txtCodigoString.setEditable(false);
       }    
    }//GEN-LAST:event_comboClienteItemStateChanged

    private void btnRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarActionPerformed
       if(!chequeList.isEmpty()){ 
            registrarBolsaDeCheque();
       }else{ 
            JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("emptyListOfBolsaCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
       }
    }//GEN-LAST:event_btnRegistrarActionPerformed


    
    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        noRefrescarTabla = true;
        dispose();
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void txtImporteFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtImporteFocusLost
//        esValidoElImporte();
    }//GEN-LAST:event_txtImporteFocusLost

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        montoTotalBolsa = 0;
        frmCheque.btnActualizar.doClick();
    }//GEN-LAST:event_formWindowClosed

       
    
    private void txtImporteKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtImporteKeyPressed
        if(evt.getKeyCode() == KeyEvent.VK_ENTER){
            if(esValidoElImporte()){
               registrarCheque();
               }
            }   
        
    }//GEN-LAST:event_txtImporteKeyPressed

    private void txtCodigoStringKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoStringKeyPressed
        if(evt.getKeyCode() == KeyEvent.VK_ENTER){
            String codigoDeCheque = txtCodigoString.getText(); 
           if(codigoDeCheque.length() > 0){
                txtCodigoString.setText(chequeServices.limpiarCodigoDeCheque(codigoDeCheque)); 
                if(txtCodigoString.getText().length() == ChequeServices.TAMANO_CODIGO_CHEQUE){
                    if(!chequeServices.isChequeRegistered(txtCodigoString.getText())){
                        if(!existeChequeEnBolsa(txtCodigoString.getText())){
                             validarDatosDeCheque(txtCodigoString.getText());
                        }else{
                            txtCodigoString.requestFocus();
                            txtCodigoString.selectAll();
                            mostrarLabelDeChequeValido(CHEQUE_INVALIDO);
                            JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("duplicatedChequeOnBolsa"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                        }
                    }else{
                        JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("duplicatedCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                        txtCodigoString.requestFocus();
                        txtCodigoString.selectAll();
                        mostrarLabelDeChequeValido(CHEQUE_INVALIDO);
                        limpiarFormulario();
                    }
                } else {
                        JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("invalidCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                        limpiarFormulario();
                        txtCodigoString.requestFocus();
                        txtCodigoString.selectAll();
                        mostrarLabelDeChequeValido(CHEQUE_INVALIDO);
                }
           } else {
                    JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("requiredInputCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                    txtCodigoString.requestFocus();
           }
        }
    }//GEN-LAST:event_txtCodigoStringKeyPressed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        
        System.out.println("index   : "+tblBolsaCheques.getSelectedRow());
        System.out.println("rowCount: "+tblBolsaCheques.getRowCount());
      
        if(tblBolsaCheques.getSelectedRow() != -1){
        if((tblBolsaCheques.getSelectedRow() < tblBolsaCheques.getRowCount()) && (!chequeList.isEmpty()) ){
            DefaultTableModel model     = (DefaultTableModel)tblBolsaCheques.getModel();
            Cheque chequeSelected       =  (Cheque)model.getValueAt(tblBolsaCheques.convertRowIndexToView(tblBolsaCheques.getSelectedRow()), 0);
            int indice                  = getIndexChequeFromList(chequeSelected);
            Cheque cheque = chequeList.remove(indice);
            actualizarMontoTotalDeBolsa(cheque.getImporte().doubleValue() ,RESTAR);
            cargarTablaBolsaDeCheques(chequeList);
         
        } else {
            JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("requiredSelectedCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
        }  
        } else {
            JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("requiredSelectedCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
        } 
    }//GEN-LAST:event_btnEliminarActionPerformed

    
    public boolean existeChequeEnBolsa(String codigoStringDeCheque){
        boolean existe = false;
        for(Cheque cheque : chequeList){
            if(cheque.getCodigoString().equals(codigoStringDeCheque)){
                existe = true;
            }
        }
        return existe;
    }
    
    
    public int getIndexChequeFromList(String cod_cheque){
        int i = 0;
        for(Cheque cheque : chequeList){
            if(cheque.getChequeNro().equals(cod_cheque)){
              break;
            }
            i++;
        } 
        return i;
    }
    
    
    public int getIndexChequeFromList(Cheque chequeSelected){
        int i = 0;
        for(Cheque cheque : chequeList){
            if(cheque.getCodigoString().equals(chequeSelected.getCodigoString())){
              break;
            }
            i++;
        } 
        return i;
    }
    
    
    
    
  
    
    public void mostrarLabelDeChequeValido(boolean esValido){
        if(esValido){
          lblChequeCorrecto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/check.png")));
        }else{
          lblChequeCorrecto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ar/republicagroup/gestion/view/images/cancel.png")));
        }
        lblChequeCorrecto.setVisible(true);
    }
    
    
    private void comboChequeTipoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_comboChequeTipoKeyPressed
         if(evt.getKeyCode() == KeyEvent.VK_ENTER){
           txtImporte.getText();
       }
    }//GEN-LAST:event_comboChequeTipoKeyPressed

    private void btnInspeccionarChequeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInspeccionarChequeActionPerformed
        if((tblBolsaCheques.getSelectedRow() != -1) && (!chequeList.isEmpty()) ){
            /* Obtenemos el cheque seleccionado */
            DefaultTableModel model          = (DefaultTableModel)tblBolsaCheques.getModel();
            Cheque chequeSelected            =  (Cheque)model.getValueAt(tblBolsaCheques.convertRowIndexToView(tblBolsaCheques.getSelectedRow()), 0);  
            /* Obtenemos el id del Cliente seleccionado */
            JComboBoxModel model_cliente     = (JComboBoxModel) comboCliente.getSelectedItem();
            int id_cliente                   = Integer.valueOf(model_cliente.getValue());
            
            modalPanelEditCheque panelEditCheque = new modalPanelEditCheque(null, true);
            panelEditCheque.setClienteId(id_cliente);
            panelEditCheque.setChequeToUpdate(chequeSelected);
            panelEditCheque.setEditandoEnBolsa(true);
            panelEditCheque.setLocationRelativeTo(this);
            panelEditCheque.setVisible(true);
       }else {
            JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("requiredSelectedCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
       }             
    }//GEN-LAST:event_btnInspeccionarChequeActionPerformed

    private void chkAsignarACuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkAsignarACuentaActionPerformed
            if(chkAsignarACuenta.isSelected()){
                comboCuentaBanco.setEnabled(true);
            }else{
                comboCuentaBanco.setEnabled(false);
            }
    }//GEN-LAST:event_chkAsignarACuentaActionPerformed

    
    
    /* Pasar a lógica de negocio de ChequeServices */
    public void validarDatosDeCheque(String codigo_cheque_ingresado){
                String cod_cuenta_banco		= null;
		String cod_cuenta_sucursal	= null;
		String cod_postal 		= null;
		String nro_cheque               = null;
		String cuenta_bancaria		= null;
		String codigo_de_cheque 	= codigo_cheque_ingresado;
                
                    
                /* DESCOMPONEMOS LA CADENA Y OBTENEMOS LOS CODIGOS RESPECTIVOS */
                cod_cuenta_banco                    = codigo_de_cheque.substring(0, 3);
                cod_cuenta_sucursal                 = codigo_de_cheque.substring(3, 6);
		cod_postal                          = codigo_de_cheque.substring(6,10);
                nro_cheque                          = codigo_de_cheque.substring(10, 18);
		cuenta_bancaria                     = codigo_de_cheque.substring(18);
                banco                               = bancoServices.findBancoByCodCuenta("00"+cod_cuenta_banco, false);
                        
                            if(banco != null){
                                txtBanco.setText(banco.getNombre());
                                String origen                       = codigoPostalServices.getOrigenOfCodigoPostalByCodigo(Integer.valueOf(cod_postal));
                                txtOrigen.setText(origen);
                                txtNroCheque.setText(nro_cheque);
                                txtNroCuenta.setText(cuenta_bancaria);
                        
                                    if(origen.equals(ChequeServices.ORIGEN_CAP_BSAS)){
                                        txtComision.setText(cliente.getComisionBa().toString());
                                    }else{
                                        txtComision.setText(cliente.getComisionInterior().toString());
                                    }
                                    habilitarCombos(true);
                                    cheque_valido = true;
                                    comboChequeTipo.requestFocus();
                                    mostrarLabelDeChequeValido(CHEQUE_VALIDO);
                            } else {
                                JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("invalidBanco"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                                txtCodigoString.requestFocus();
                                txtCodigoString.select(0, 3);
                            }
    }
    
    
    public void registrarCheque(){
                /*Obtenemos los id de los combos*/
                JComboBoxModel model_tipocheque     = (JComboBoxModel)comboChequeTipo.getSelectedItem();
                  
                /*Cargamos los datos en el Bean de Cheque*/
                Cheque cheque = new Cheque();
		cheque.setChequeNro(txtNroCheque.getText());
		cheque.setCodigoString(txtCodigoString.getText());
		cheque.setFechaAlta(new Date());
		cheque.setCodigoCtaBancaria(txtNroCuenta.getText());
		cheque.setImporte(BigDecimal.valueOf(Double.parseDouble(txtImporte.getText())));
                cheque.setBancoId(banco);
                cheque.setChequeTipoId(new ChequeTipo(Integer.valueOf(model_tipocheque.getValue())));
                cheque.setComision(BigDecimal.valueOf(Double.parseDouble(txtComision.getText())));
                cheque.setOrigen(txtOrigen.getText());
                cheque.setCuentaBancoId(new CuentaBanco(1));
                cheque.setChequeEstadoId(new ChequeEstado(1)); //Harcoded
                cheque.setEstado(1);
                
                /*Agregamos el cheque al listado de Cheques*/
                actualizarMontoTotalDeBolsa(Double.parseDouble(txtImporte.getText()),SUMAR);
                chequeList.add(cheque);
                cargarTablaBolsaDeCheques(chequeList);
                limpiarFormulario();
    }
    
    
    public void registrarBolsaDeCheque(){
        BolsaCheque nuevaBolsa = new BolsaCheque();
        nuevaBolsa.setFechaAlta(Calendar.getInstance().getTime());
        nuevaBolsa.setClienteId(cliente);
        nuevaBolsa.setUsuarioId(new Usuario(UserSession.getInstance().getUser_id()));
        /* Si se va a asignar una cuenta a la bolsa , le actualizamos la CuentaBanco a los cheques */
        if(chkAsignarACuenta.isSelected()){
            JComboBoxModel comboModel       = (JComboBoxModel)comboCuentaBanco.getSelectedItem();
            CuentaBanco cuentaBanco         = cuentaBancoServices.get(Integer.parseInt(comboModel.getValue()));
            chequeList                      = cuentaBancoServices.assignCuentaBancoToThisCheques(chequeList, cuentaBanco);
        }
        
        nuevaBolsa.setChequeList(chequeList);
        nuevaBolsa.setEstado(1);
        
        String mensaje =  bolsaChequeServices.insert(nuevaBolsa);
           
        if(mensaje != null){
                mostrarMensajeJOptionPane(mensaje, UIMessages.getInfoMessage("onCompleteInsert_title"),JOptionPane.INFORMATION_MESSAGE);
                int resp = JOptionPane.showConfirmDialog(this, UIMessages.getQuestionMessage("register_another_bolsa"), UIMessages.getQuestionMessage("register_another_title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (resp == 0){
                        limpiarFormulario();
                        reiniciarValores();
                        cargarTablaBolsaDeCheques(chequeList);
                     }else{ 
                                        dispose();
                     }
        } else {
                     JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("onInsertError"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
        }
    }
    
    
    private void actualizarMontoTotalDeBolsa(double monto,int operacion){
        
        if(operacion == SUMAR){
            montoTotalBolsa = montoTotalBolsa + monto;
            lblTotalCheques.setText(""+(chequeList.size()+1));
        }else{
            lblTotalCheques.setText(""+(chequeList.size()));
            montoTotalBolsa = montoTotalBolsa - monto;
        }
   
        lblMonto.setText(""+Formato.decimalComaMilesConSigno(montoTotalBolsa));
    }
    
    
    public void habilitarCombos(boolean valor){
        comboChequeTipo.setEnabled(valor);
    }
    
    public void mostrarMensajeJOptionPane(String mensaje,String titulo_ventana,int tipo_de_mensaje){
        JOptionPane.showMessageDialog(this, mensaje, titulo_ventana, tipo_de_mensaje);
    }
    
    public void limpiarFormulario(){
         /*Cajas de texto*/   
         txtCodigoString.setText("");
         txtBanco.setText("");
         txtNroCheque.setText("");
         txtNroCuenta.setText("");
         txtOrigen.setText("");
         txtComision.setText("");
         txtImporte.setText("");
         /*Combos*/
         comboChequeTipo.setSelectedIndex(0);
         /*Focus*/
         txtCodigoString.requestFocus();
         lblChequeCorrecto.setVisible(false);
    }
    
    public void reiniciarValores(){
                 
         if(!chequeList.isEmpty()){
            montoTotalBolsa = 0;
            lblMonto.setText(""+montoTotalBolsa);
            lblTotalCheques.setText("0");
            chequeList.removeAll(chequeList);
         }
    
    
    }
    
    
    public void cambiarCliente(){
       comboCliente.setEnabled(true);
        comboCliente.setSelectedIndex(0);
        comboCliente.requestFocus();
    }
    
    
    /***VALIDACIONES*/
    public boolean esValidoElFormulario(){
        if(Validar.esVacio(txtCodigoString.getText()) || Validar.validarVacio(txtCodigoString.getText())){
            mostrarMensajeJOptionPane(UIMessages.getErrorMessage("requiredInputCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
            txtCodigoString.requestFocus();
            return false;         
        }
        
        if(!cheque_valido){
            mostrarMensajeJOptionPane(UIMessages.getErrorMessage("invalidCheque"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
            txtCodigoString.requestFocus();
            txtCodigoString.selectAll();
            return false;
        }
        
        if(comboCliente.getSelectedIndex()==0){
            mostrarMensajeJOptionPane(UIMessages.getErrorMessage("requiredSelectedCliente"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
            comboCliente.requestFocus();
            return false;
        }
        
        if(!esValidoElImporte()){
            mostrarMensajeJOptionPane(UIMessages.getErrorMessage("invalidImporte"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
            return false;
        }
        
        return true;
    }
    
    /*Pasar a una clase UTIL */
    public boolean esValidoElImporte(){
        txtImporte.setText(Validar.cambiarComaPorPuntoEnCadena(txtImporte.getText())); 
       if(!Validar.esVacio(txtImporte.getText())&& !Validar.validarVacio(txtImporte.getText())){
           if(Validar.validarLongitud(Validar.LONGITUD_MAXIMA_DOUBLE, txtImporte.getText())){
            if(Validar.esUnDatoDouble(txtImporte.getText()) && Double.parseDouble(txtImporte.getText())>0){
                return true;
                } else{
                    JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("decimal"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
                    return false;
                }
           }else{
               JOptionPane.showMessageDialog(this, UIMessages.getErrorMessage("maxLengthDecimal"), UIMessages.getErrorMessage("defaultErrorTitle"), JOptionPane.ERROR_MESSAGE);
               txtImporte.setText("0");
               return false;
           }
       }else{
           lblErrorImporte.setText(UIMessages.getInfoMessage("requiredField"));
           lblErrorImporte.setVisible(true);
           return false;
       }
    
    }
    
    
    
    public static void main(String args[]) {
        
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                modalPanelAddCheque dialog = new modalPanelAddCheque(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnInspeccionarCheque;
    private javax.swing.JButton btnRegistrar;
    private javax.swing.JCheckBox chkAsignarACuenta;
    private javax.swing.JComboBox comboChequeTipo;
    private javax.swing.JComboBox comboCliente;
    private javax.swing.JComboBox comboCuentaBanco;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblChequeCorrecto;
    private javax.swing.JLabel lblErrorImporte;
    private static javax.swing.JLabel lblMonto;
    private javax.swing.JLabel lblTotalBolsa;
    private static javax.swing.JLabel lblTotalCheques;
    private javax.swing.JPanel panelContenedor;
    private static javax.swing.JTable tblBolsaCheques;
    private javax.swing.JTextField txtBanco;
    private javax.swing.JTextField txtCodigoString;
    private javax.swing.JTextField txtComision;
    private javax.swing.JTextField txtImporte;
    private javax.swing.JTextField txtNroCheque;
    private javax.swing.JTextField txtNroCuenta;
    private javax.swing.JTextField txtOrigen;
    // End of variables declaration//GEN-END:variables
}
